package com.lyzx.newboot2.day01.helloworld;


import com.lyzx.newboot2.day01.helloworld.model.Apple;
import com.lyzx.newboot2.day01.helloworld.model.Berry;
import com.lyzx.newboot2.day01.helloworld.model.Mango;
import com.lyzx.newboot2.day01.helloworld.model.User;

import java.math.BigDecimal;

public class MainApplication {

    public static void main(String[] args) {
        t4();
    }

    public static void t4(){
        Apple apple = new Apple(new BigDecimal(("200.2")), new BigDecimal(8), null);   //1601.6
        Berry berry = new Berry(new BigDecimal(("189.2")), new BigDecimal(13), null);  //2459.6
        Mango mango = new Mango(new BigDecimal(("111.2")), new BigDecimal(20), null);  //2224
        User user = new User("D", apple, berry, mango);
        BigDecimal totalMoney = user.getTotalMoney();
        if(totalMoney.compareTo(new BigDecimal("10")) > 0 ){
            totalMoney = totalMoney.subtract(new BigDecimal("10"));
        }
        System.out.println(user.say(totalMoney));
    }


    public static void t3(){
        Apple apple = new Apple(new BigDecimal(("100.2")), new BigDecimal(8), null);
        Berry berry = new Berry(new BigDecimal(("89.2")), new BigDecimal(13), new BigDecimal("0.8"));
        Mango mango = new Mango(new BigDecimal(("1.2")), new BigDecimal(20), null);
        User user = new User("C", apple, berry, mango);
        System.out.println(user.say());
    }

    public static void t2(){
        Apple apple = new Apple(new BigDecimal(("100.2")), new BigDecimal(8), null);
        Berry berry = new Berry(new BigDecimal(("89.2")), new BigDecimal(13), null);
        Mango mango = new Mango(new BigDecimal(("1.2")), new BigDecimal(20), null);
        User user = new User("B", apple, berry, mango);
        System.out.println(user.say());
    }

    public static void t1(){
        Apple apple = new Apple(new BigDecimal(("10.2")), new BigDecimal(8), null);
        Berry berry = new Berry(new BigDecimal(("8.2")), new BigDecimal(13), null);
        User user = new User("A", apple, berry, null);
        System.out.println(user.say());
    }
}
